<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>10-01 beginPath</title>
</head>
<body>
  <canvas id="c" width="300" height="200" style="border: 1px solid #ccc;"></canvas>

  <script>
    const context = document.getElementById('c')
    const ctx = context.getContext('2d')

    // 第一条线，粉色
    ctx.moveTo(50, 40)
    ctx.lineTo(150, 40)
    ctx.strokeStyle = 'pink' // 粉色描边
    ctx.lineWidth = 10
    ctx.stroke()

    // 圆形
    ctx.beginPath() // 开辟新的路径
    ctx.arc(150, 120, 40, 0, 360 * Math.PI / 180)
    ctx.strokeStyle = 'skyblue' // 蓝色描边
    ctx.lineWidth = 4
    ctx.stroke()
  </script>
</body>
</html>